package com.team.controller;

import com.team.entity.MedicalAdvice;
import com.team.service.MedicalAdviceService;
import com.team.service.RegistryService;
import com.team.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/medicalAdvice")
@ResponseBody
public class MedicalAdviceController {
    @Autowired
    private MedicalAdviceService medicalAdviceService;
    @Autowired
    private RegistryService registryService;
    @RequestMapping("add")
    public Result addMedicalAdvice(MedicalAdvice medicalAdvice){
        int temp= medicalAdviceService.addMedicalAdvice(medicalAdvice);
        int flag= registryService.updateStatus(medicalAdvice.getRegistryId(),3);
        if (temp>0&&flag>0){
            return new Result("200","success");
        }else {
            return new Result("500","fail");
        }
    }
}
